import java.util.Scanner;
public class task5 {

	public static void main(String[] args) {

		int L3=0 , L1 , L2 ,j,i;
		String str1 , str2 , str3;

		Scanner scanner = new Scanner(System.in);
		
		System.out.print("Enter String1 of distinct characters:");
		str1 = scanner.nextLine();
		
		System.out.print("Enter String2 of distinct characters:");
		str2 = scanner.nextLine();
		
		str3="";
		
		L1 = str1.length();
		L2 = str2.length();
		
		for(i=0 ; i < L1 ; i++)
		{
			if(Character.isLowerCase(str1.charAt(i)))
			{
				for(j=0;j<L2;j++)
				{
					if(str1.charAt(i)==str2.charAt(j))
					{
						str3 = str3 + str1.charAt(i);
						break;
					}
				}
			}	
		}
		
		L3 = str3.length();
		
		System.out.printf("The number of lowercase characters of string1 that are in string2 is %d%n",L3);
		if(L3 > 0)
		System.out.print("The characters are:"+str3);
		
		
		scanner.close();

	}

}
